home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
telecomm
/
sticpsrc.lzh
/
DOC
/
ENVIRON.ARC
/
ENVIRON.DOC
next >
Wrap
Text File
|
1989-03-05
|
7KB
|
188 lines
06601030305800
⇧
⇩#
F0110030
9[...................................................]001
êEnvironmentvariablesinNETÇ
ByRobJanssen,PE1CHL.
NEThasbeenenhancedwithsupportforvariables.Thismeansyou
cansetvariablestosome(string)value,andusethesevaluesin
commands.Thisisespeciallyusefulintheconfigurationfiles.
Also,somevariablenamesarereservedtoholdthenamesofthe
differentdirectoriesandfilesreferencedbyNET,sothatyou
cannowlocatethesewhereveryoulike.
êsetenvcommandÇ
Variablesaresetusingthe"setenv"commandinNET.The
possibleusesare:
setenv
setenvwithoutparametersdisplaysthecurrentlydefined
variables,inalphabeticorder,withtheirvalues.
setenvnamevalue
thevariable"name"isgiven"value"asit'svalue.the
previousvalueof"name"islost,andthevariableis
createdautomaticallyifitdidnotyetexist.
setenvname
thevariable"name"losesit'svalueandwillnotbe
displayedby"setenv"anymore.thisisdifferentfrom
assigninganemptyvaluetothevariable,whichcanbedone
using:setenvname"".
setenvname=value
thisformisallowedasanalternativetothesecondcase.
Thenameofavariablecancontainletters,digitsandthe
underscorecharacter,anditisalwaysconvertedtoUPPERCASE
beforeitisstoredorreferenced.
Afteravariablehasbeenassignedusingsetenv(orothermeans,
seebelow),itcanbeusedin2basicallydifferentways:
ê1.ImplicitlyusedbyNETÇ
Whenthenameofthevariableisoneofthereservednames,NET
willautomaticallyuseit.Itisgenerallyunwisetosetthese
reservedvariablestoemptyornonsensevalues,asthismaycause
problemsintheoperationofNET.
Thereservednamesare:
NETSTART Initialization file
NETUSERS Authorized FTP users and passwords
NETHOSTS Network host table
ÇNETFINGER Finger file path
NETMAILS Incoming mail
NETMAILQ Outgoing mail spool
NETROUTEQ Queue for router
NETALIAS The alias file
And,ontheAtariST:
TMPDIR Temp files directory
So,byusingthecommand"setenvNETHOSTSd:\hosts.net",you
changethenameofthehostsfileto"d:\hosts.net",andifthis
isonaRAM-diskthelookupofhostnameswillbesomewhatfaster.
ê2.ExplicituseinaNETcommandÇ
AvariablecanbeusedineveryNETcommandinsteadof(partsof)
acommandnameoraparameter.Variablesarereferencedusing
the$signfollowedbytheirname,asin:
attachnetrom$CALLSIGN
Inthiscase,$CALLSIGNisreplacedbythecontentsofthe
variableCALLSIGNbeforethecommandisexecuted.Avariablecan
alsocontainpartofaparameter,asin:
attachasy3f84ax25ax05122564800$CALLSIGN-2
Inthiscase,the-2ssidwillbeappendedtothecallsignstored
inthevariableCALLSIGN.
Whenthetexttobeappendedcouldbemistakenforpartofthe
variablename,thenamecanbeenclosedinbraces:${VARNAME}000.
Therealsoexistsomemoreadvancedwaysofreferencing
variables,tomakeitpossibletoprovidedefaultsforundefined
ones:
${NAME-default}
ThiswillreturnthevalueofthevariableNAMEifitis
defined,or"default"ifNAMEisundefined.
${NAME=default}
Actsthesameasthepriviouscase,butitadditionallysets
thevariableNAMEtovalue"default"ifitdidnotexist.
${NAME?text}
WhenNAMEisdefined,returnsit'svalue.Ifnot,itprints
"text"andthecommandlineisnotexecuted.When"text"is
notpresent,"undefinedvariable"isprinted.
${NAME+text}
WhenNAMEisdefined,returns"text".WhenNAMEisnot
defined,returnsanemptystring.
Ç
êInitialsettingofvariablesÇ
ThevalueofvariablesatthetimeNETisstartedisdetermined
asfollows:
1.WhenNETisstarted,thevariabletableisempty.Itfirst
insertsdedefaultvaluesofthe"reserved"variablesinto
thetable.Thevaluesarethepathnamesthatusedtobe
fixedinearlierreleases,e.g.:
NETMAILQ=/spool/mqueue/
2.Thevariablesintheenvironmentpassedbytheoperating
systemareaddedtothetable,possiblyreplacingthe
defaults.Thismeansavariablecanbegivenaninitial
valuebyputtingitintheenvironmentoftheshellthat
startsNET(inMS-DOS:usingaSETcommandinCOMMAND.COM)
3.ParameterstotheNETprogramoftheform"name=value"are
parsedas"setenv"commands.Thiscontinuesfromleftto
rightuntilaparameterisencounteredthatdoesnotcontain
an"="sign,orallparametershavebeenparsed.
4.NETperformsinternalinitializations,thatpossiblyusethe
variablesdefineduptothismoment.Thereafteritprints
thebanner.
5.Whentherearenomoreparameters,thefilewhosenameisin
thevariableNETSTARTisexecutedasacommandfile.
NormallythiswillbeAUTOEXEC.NET.
Ifthereareparametersleftatthispoint,theyare
examinedfromlefttoright.Iftheydon'tcontainan"="
signtheyareassumedtobefilenamesandexecutedasa
commandfile,iftheydocontainan"="theyareparsedas
"setenv"commands.
6.ThepromptisprintedandNETstartsoperating
interactively.
ExampleofaNETcommandlines:
netcallsign=pe1chlautoexec.st2running=1
ThisstartsNETwithvariableCALLSIGNsettovalue"pe1chl",
thenNETreadsthestartupfile"autoexec.st2"andafterthisfile
hasbeencompletelyexecuted,variableRUNNINGissetto1.
netcallsign=pe1chl
Sameasabove,butthedefaultstartupfiledefinedinNETSTART
isexecutedwithvariableCALLSIGNsetto"pe1chl".
Notethatinthiscaseitisstillpossibletorunanonstandard
Çstartupfileifyoudefineit'snameintheenvironmentofthe
shell.ForMS-DOSthiscanbedonebytyping
setnetstart=autoexec.2
fromtheCOMMAND.COMprompt.
êEnvironmentpassedtosub-shellsÇ
WhenNETstartsasub-shell(usingthecommand"shell"or"!"),
itpassesthevaluesofallvariablesasanenvironmenttothis
sub-shell.Asitreadsintheenvironmentitselfduringstartup,
thispassedenvironmentatleastcontainstherequiredvariables
foreveryexecutedshell.
Butasitalsocontainsthevariablesthatyoucansetyourself,
thisfeaturecanbeusedtodefinetheenvironmentforamailer
runfromNET,usingsetenvcommandsinthestartupfile.